extends Node;

const kbnumKeys = [
	KEY_KP_1, KEY_KP_2, KEY_KP_3, KEY_KP_4, KEY_KP_5, 
	KEY_KP_6, KEY_KP_7, KEY_KP_8, KEY_KP_9, KEY_KP_0, 
]
const npnumKeys = [
	KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, 
	KEY_6, KEY_7, KEY_8, KEY_9, KEY_0, 
]
var numkeys = range(10).map(func (i): return [kbnumKeys[i], npnumKeys[i]]);

func getDir(dir):
	return kp([KEY_D, KEY_W, KEY_A, KEY_S][dir])

func kp(x):
	return int(Input.is_key_pressed(x))
	
func mp(x):
	return int(Input.is_mouse_button_pressed(x))

func ap(x):
	return int(Input.is_action_pressed(x))
	
func ajp(x):
	return int(Input.is_action_just_pressed(x))
func ajr(x):
	return int(Input.is_action_just_released(x))

func numKey_factor():
	var fct = 1;
	for i in range(numkeys.size()):
		if(numkeys[i].any(func (k): return kp(k))):
			fct += 3 ** (i+1);
	return fct

#func reload_game():
	#var t = get_tree();
	#var mc = t.get_nodes_in_group('main_container')[0];
	#var nodes = mc.get_children()
	#nodes.map(func (x): 
		#mc.add_child(x.duplicate()); 
		#x.free();
		#return 0;
	#)
	#

# 齿轮缩放碰撞
# 无限转速

# 动画总线
#	var anim_percent = 0.0
#	var anim_frame ?= 5.01
# 自由动画+碰撞？

# Mecha
